{extend name="public:layout" /}
{block name="title"}站点配置{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">

        <div class="ibox-title">
            <ol class="breadcrumb">
                <li class="active"><i class="fa fa-hand-o-right"></i> 站点配置</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <div class="pull-left">
                    <a href="{:url('add')}" class="btn btn-primary">添加配置</a>
                    <a href="{:url('updateCache')}" class="btn btn-info">更新缓存</a>
                </div>
                <div class="pull-right">
                    <a href="{:url('ConfigGroup/index')}" class="btn btn-info">配置组管理</a>
                </div>
                <div class="clearfix"></div>
            </div>

            <form method="post" class="form-horizontal" id="form">
                <!-- Nav tabs -->
                <ul class="nav nav-tabs" role="tablist">
                    {volist name="config" id="vo"}
                    {eq name="i" value="1"}
                    <li class="active">
                        <a href="#{$vo.group_name}" role="tab" data-toggle="tab">{$vo.group_title}</a>
                    </li>
                    {else/}
                    <li>
                        <a href="#{$vo.group_name}" role="tab" data-toggle="tab">{$vo.group_title}</a>
                    </li>
                    {/eq}
                    {/volist}
                </ul>
                <!-- Tab panes -->
                <div class="tab-content">
                    {volist name="config" id="vo"}
                    <div role="tabpanel" class="tab-pane {eq name='i' value='1'}active{/eq}" id="{$vo.group_name}">
                        <table class="table">
                            <thead>
                            <tr>
                                <th width="40">排序</th>
                                <th width="150">标题</th>
                                <th width="300">配置</th>
                                <th width="100">变量</th>
                                <th width="200">描述</th>
                            </tr>
                            </thead>
                            {volist name="vo['_config']" id="c"}
                            <tr valign="middle">
                                <td>
                                    <input type="text" class="form-control input-sm" style="width:40px;"
                                           name="config[{$c.id}][config_sort]" value="{$c.config_sort}"
                                           datatype="n" nullmsg="请填写排序字段！" errormsg="排序字段必须为数字" />
                                    <input type="hidden" name="config[{$c.id}][id]" value="{$c['id']}"/>
                                </td>
                                <td>
                                    {$c.title}
                                    {eq name="c.system" value="0"}
                                    <a href="javascript:;" onclick="doAction(this);"
                                       data-msg="确认删除吗？" data-url="{:url('del')}" data-params="id={$c.id}">删除</a>
                                    {/eq}
                                </td>
                                <td>{$c._html}</td>
                                <td>{$c.name}</td>
                                <td>{$c.message}</td>
                            </tr>
                            {/volist}
                        </table>
                    </div>
                    {/volist}
                </div>
                <button class="btn btn-primary" type="button" id="btnSub">确认</button>
                <span id="validError"></span>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        iCheck();
        ajaxSubForm('#btnSub');
    })
</script>
{/block}